package com.iplant.pdm.service.po.fpc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.pdm.service.basicenum.pdm.PDMComponentTypes;

import java.io.Serializable;

/**
 * 产品组成
 */
@DBBasePO(TableName = "fpc_product_com", CheckName = {"ProductID,ComponentType,TargetComponentType,ComponentNumber"},
        Name = false, Active = false, Code = false,
        Schemas = DBSchemas.PDM)
public class FPCProductCom extends BasePO implements Serializable {

    private static final long serialVersionUID = 1L;

    @DBField
    @DBCondition
    public int ProductID = 0;//产品ID
    @DBJoin(name = "Name", tableName = "fpc_product", tableAsName = "f1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductName = "";//产品名称
    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "f1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductCode = "";//产品编码


    /**
     * 来源类型
     */
    @DBCondition
    @DBField
    public int ComponentType = 0;

    public String ComponentTypeName = "";

    /**
     * 产出类型
     */
    @DBCondition
    @DBField
    public int TargetComponentType = 0;

    public String TargetComponentTypeName = "";

    @DBField
    public float ComponentNumber = 0.0f;


    @DBField(CheckValue = true)
    @DBCondition
    public int MaterialID = 0;//物料ID
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "mss_material", tableAsName = "m1", Schemas = DBSchemas.Basic,
            MainTableField = "MaterialID")
    public String MaterialNo = "";//物料编码
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "mss_material", tableAsName = "m1", Schemas = DBSchemas.Basic,
            MainTableField = "MaterialID")
    public String MaterialName = "";//物料名称


    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductName")
    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }

    @JsonProperty("ProductCode")
    public String getProductCode() {
        return ProductCode;
    }

    public void setProductCode(String productCode) {
        ProductCode = productCode;
    }

    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("ComponentTypeName")
    public String getComponentTypeName() {

        ComponentTypeName = PDMComponentTypes.getEnumType(ComponentType).getLabel();
        return ComponentTypeName;
    }

    public void setComponentTypeName(String componentTypeName) {
        ComponentTypeName = componentTypeName;
    }

    @JsonProperty("TargetComponentType")
    public int getTargetComponentType() {
        return TargetComponentType;
    }

    public void setTargetComponentType(int targetComponentType) {
        TargetComponentType = targetComponentType;
    }

    @JsonProperty("TargetComponentTypeName")
    public String getTargetComponentTypeName() {
        TargetComponentTypeName = PDMComponentTypes.getEnumType(TargetComponentType).getLabel();
        return TargetComponentTypeName;
    }

    public void setTargetComponentTypeName(String targetComponentTypeName) {

        TargetComponentTypeName = targetComponentTypeName;
    }

    @JsonProperty("ComponentNumber")
    public float getComponentNumber() {
        return ComponentNumber;
    }

    public void setComponentNumber(float componentNumber) {
        ComponentNumber = componentNumber;
    }

    @JsonProperty("MaterialID")
    public int getMaterialID() {
        return MaterialID;
    }

    public void setMaterialID(int materialID) {
        MaterialID = materialID;
    }

    @JsonProperty("MaterialNo")
    public String getMaterialNo() {
        return MaterialNo;
    }

    public void setMaterialNo(String materialNo) {
        MaterialNo = materialNo;
    }

    @JsonProperty("MaterialName")
    public String getMaterialName() {
        return MaterialName;
    }

    public void setMaterialName(String materialName) {
        MaterialName = materialName;
    }
}
